//--------------------------------------------------------------
//
// Qizhi Zhang 
// ezhung@gmail.com
// http://www.moorwind.com
//
//--------------------------------------------------------------
package reader.view
{
	import __AS3__.vec.Vector;
	
	import flash.events.Event;
	
	import org.puremvc.as3.multicore.interfaces.IMediator;
	import org.puremvc.as3.multicore.interfaces.INotification;
	
	import reader.core.ReaderModelLocator;
	import reader.model.IDataProxy;
	import reader.view.components.AirExplorer;

	public class AirExplorerMediator extends BaseApplicationMediator implements IMediator
	{
		////////////////////////////////////////////////////////////////////////////////
		//public properties
		
		public static const NAME:String = "AirExplorerMediator";
		
		public function get airExplorer():AirExplorer
		{
			return this.viewComponent as AirExplorer;
		}
		
		////////////////////////////////////////////////////////////////////////////////
		//private variables
		
		private var dataProxy:IDataProxy;
		
		private var readerModelLocator:ReaderModelLocator = ReaderModelLocator.instance;
		
		//////////////////////////////////////////////////////////////////////////////
		//constructor
		public function AirExplorerMediator(viewComponent:Object=null)
		{
			super(NAME, viewComponent);
			dataProxy = facade.retrieveProxy(readerModelLocator.sqliteProxyFactory.dataProxyName) as IDataProxy;
		}
		
		//////////////////////////////////////////////////////////////////////////////
		//methods
		
		override public function listNotificationInterests():Vector.<String>
		{
			return Vector.<String>([null]);
		}
		
		override public function handleNotification(notification:INotification):void
		{
		}
		
		//////////////////////////////////////////////////////////////////////////////
		//events
		
		private function onCloseWindow_handler(e:Event):void
		{
			facade.removeMediator(NAME);
			
			airExplorer.close();
		}
		
	}
}